package com.huawei.fastengine.fastview.download.utils;

import android.app.Activity;
import android.content.Context;
import android.os.Build.VERSION;
import com.huawei.fastengine.fastview.download.utils.log.FastViewLogUtils;

public abstract class ActivityUtil {
    private static final int ANDROID_4_2 = 17;
    private static final String TAG = "ActivityUtil";

    public static boolean isActivityDestroyed(Context context) {
        if (context == null) {
            return true;
        }
        if (context instanceof Activity) {
            Activity activity = (Activity) context;
            if (activity.isFinishing() || (VERSION.SDK_INT >= 17 && activity.isDestroyed())) {
                FastViewLogUtils.w(TAG, "activity has bean finished, cannot instance:");
                return true;
            }
        }
        return false;
    }
}
